import pynmea2
nmea = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47"
msg = pynmea2.parse(nmea)
print("消息类型:", type(msg).__name__)
print(f"时间: {msg.timestamp}")
print(f"纬度: {msg.latitude:.7f}°")
print(f"经度: {msg.longitude:.7f}°")
print(f"定位质量: {msg.gps_qual} (1=Fix)")
print(f"卫星数: {msg.num_sats}")
print(f"HDOP: {msg.horizontal_dil}")
print(f"海拔: {msg.altitude} {msg.altitude_units}")
print(f"位置类型: {'有效' if msg.gps_qual != '0' else '无效'}")